/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sk.tuke.magsa.tools.metamodel.constraints;

import sk.tuke.magsa.tools.metamodel.Type;
import yajco.annotation.Before;
import yajco.annotation.Token;

/**
 *
 * @author M@tej
 */
public class Length extends Constraint{
    private int minLength;
    private int maxLength;
    
    @Before("length")
    public Length(@Token("INT_VALUE")int min, @Token("INT_VALUE")int max) 
    {
        this.minLength = min;
        this.maxLength = max;
    }
    
    public int getMaxLength()
    {
        return this.maxLength;
    }
    
    public int getMinLength()
    {
        return this.minLength;
    }
    
    @Override
    public String toString()
    {
        return "Min length is: " + this.getMinLength() + " and max length is: " + this.getMaxLength();
    }

    @Override
    public boolean supportsType(Type type) {
        return type.equals(Type.STRING);
    }
    
}
